package com.qige.homework.test;

public class Triangle extends Graphic{
    private double a;
    private double b;
    private double c;

    public Triangle() {
    }

    public Triangle(double a, double b, double c) {
        this.a = a;
        this.b = b;
        this.c = c;
    }
    public double getArea() {
        double p = (a + b + c) / 2;
        return Math.sqrt(p * (p - a) * (p - b) * (p - c));
    }
    public double getPerimeter() {
        return a + b + c;
    }

    @Override
    public String getInfo() {
        return "三条边分别为" + a + b + c + super.getInfo();
    }
}
